#include "Deck.h"

void InitializeDeck(deck &d)
{
	InitializeCard(d.cards[NB_DECK_CARDS]);
	InitializeCardProp(d.cards[NB_DECK_CARDS],2,2,5);
	//DisplayCard(d.cards[NB_DECK_CARDS]);
	d.nbCard = 0;
	
	Reinitialize(d);
}

void Reinitialize(deck &d)
{
	
	// Reset Cards
	//for (int i = 1; i <= 13; i++)
	//{
	//	for(int j = 1; j <= 4; j++)
	//	{
	//		card c;
	//		d.currentCard.symbol = j;
	//		InitializeCardProp(c, i, j, i);
	//		d.cards[i*j] = c;
	//		
	//	}
	//}
	for (int i = 1; i <= 13; i++)
	{
		for (int j = 1; j <= 4; j++)
		{
			card c;
			d.currentCard.symbol = j;
			InitializeCardProp(c, i, j, i);
			d.cards[d.nbCard] = c;
			d.nbCard++;
		}
	}
	d.nbCard = 0;
}

void Shuffle(deck &d, int times)
{
	for (int i = 0; i < times; i++)
	{
		for (int j = 0; j < NB_DECK_CARDS; j++)
		{
			int randomID = rand() % NB_DECK_CARDS;
			card temp = d.cards[j];
			d.cards[j] = d.cards[randomID];
			d.cards[randomID] = temp;
			times--;
		}
	}
}

card GetNextCard(deck &d)
{
	d.currentCard = d.cards[d.nbCard];
	d.nbCard++;
	return d.currentCard;
	
}

void Display(const deck &d, const card &c)
{
	//deckVisual[CARD_VISUAL_HEIGTH][CARD_VISUAL_WIDTH];
	
	return;
}
		